package Sort;

import java.util.Arrays;

public class ChooseSort {

    public static void main(String[] args) {


        int B[] = {1, 6, 9, 2, 3, 1, 5, 4,123,545,0,45,25,48,2,8,42,8,5};
        chooseSortMy(B);
        System.out.println(Arrays.toString(B));
    }

    private static void chooseSortMy(int[] A) {
        //从小到大排序，先把大的拿到最后
        for(int i = A.length-1;i >=0;i--){
            int index = i;
            for(int j = i-1;j>=0;j--){
                if(A[index]<A[j]){
                    index = j;
                }
            }
            if(index != i){
                int tmp = A[index];
                A[index] = A[i];
                A[i] = tmp;
            }

        }



    }


}
